package com.java.demo.controller;

import com.java.demo.entity.User;
import com.java.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller
public class UserController {
//    @Autowired
//    private UserService userService;



//    // setter 注入
//    private UserService userService;
//
//    @Autowired
//    public void setUserService(UserService userService) {
//        this.userService = userService;
//    }

//    private UserService userService;
//
//    @Autowired
//    public UserController(UserService userService) {
//        this.userService = userService;
//    }

    @Resource(name = "user11")
    private User user;
    public void sayHi() {
        System.out.println("controller demo");
        System.out.println(user.getUsername());
    }
}
